package com.yunchang.springboot.mapper.mwsfinance;

import com.yunchang.springboot.models.mwsfinance.FAdjustments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface FAdjustmentsMapper {
    int deleteByPrimaryKey(Long id);

    int insert(FAdjustments record);

    int insertSelective(FAdjustments record);

    FAdjustments selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FAdjustments record);

    int updateByPrimaryKey(FAdjustments record);

    /**
     * 根据createTime和reasonList集合获取对应的数据
     * @param time
     * @param reasonList
     * @return
     */
    List<FAdjustments> selectByCreateTime(@Param("time") String time,@Param("reasonList") List<String> reasonList);

    /**
     * 根据参数获取amount的和
     * @param sellerId
     * @param country
     * @param sku
     * @param date
     * @param reasonList
     * @return
     */
    Double selectSumAmountBySellerIdAndCountryAndSkuAndDateAndReasonList(@Param("sellerId") String sellerId,@Param("country") String country,@Param("sku") String sku,@Param("date") String date,@Param("reasonList") List<String> reasonList);

    /**
     * 根据参数获取quantity的和
     * @param sellerId
     * @param country
     * @param sku
     * @param date
     * @param reasonList
     * @return
     */
    Integer selectSumQuantityBySellerIdAndCountryAndSkuAndDateAndReasonList(@Param("sellerId") String sellerId,@Param("country") String country,@Param("sku") String sku,@Param("date") String date,@Param("reasonList") List<String> reasonList);

    /**
     * 根据参数获取amount和quantity的和
     * @param sellerId
     * @param country
     * @param sku
     * @param reasonList
     * @return
     */
    Map selectSumAmountAndQuantityBySellerIdAndCountryAndSkuAndDateAndReasonList(@Param("sellerId") String sellerId,@Param("country") String country,@Param("sku") String sku,@Param("reasonList") List<String> reasonList);

    /**
     * 根据日期、是否生成出入库明细数据、reason集合获取对应的数据
     * @param date
     * @param isInventoryDetails
     * @param reasonList
     * @return
     */
    List<FAdjustments> selectByDateAndIsInventoryDetailsAndReasonList(@Param("date") String date,@Param("isInventoryDetails") Integer isInventoryDetails,@Param("reasonList") List<String> reasonList);

    /**
     * 根据fAdjustmentsList对象集合更新是否生成财务数据的状态
     * @param fAdjustmentsList
     * @return
     */
    int updateIsInventoryDetailsByFAdjustmentsList(@Param("fAdjustmentsList") List<FAdjustments> fAdjustmentsList);



}